import request from '@/axios';

export const getList = (current, size, params) => request({
  url: '/zzy-system/dict/list',
  method: 'get',
  params: {
    ...params,
    current,
    size,
  },
});

export const getParentList = (current, size, params) => request({
  url: '/zzy-system/dict/parent-list',
  method: 'get',
  params: {
    ...params,
    current,
    size,
  },
});

export const getChildList = (current, size, parentId, params) => request({
  url: '/zzy-system/dict/child-list',
  method: 'get',
  params: {
    ...params,
    current,
    size,
    parentId,
  },
});

export const remove = ids => request({
  url: '/zzy-system/dict/remove',
  method: 'post',
  params: {
    ids,
  },
});

export const add = row => request({
  url: '/zzy-system/dict/submit',
  method: 'post',
  data: row,
});

export const update = row => request({
  url: '/zzy-system/dict/submit',
  method: 'post',
  data: row,
});

export const getDict = id => request({
  url: '/zzy-system/dict/detail',
  method: 'get',
  params: {
    id,
  },
});
export const getDictTree = () => request({
  url: '/zzy-system/dict/tree?code=DICT',
  method: 'get',
});

export const getDictionary = params => request({
  url: '/zzy-system/dict/dictionary',
  method: 'get',
  params,
});
